// const $http = (url, method = 'GET', data = {}) => {
 const token = uni.getStorageSync('token')
const $http = (options) => {
  let baseURL = 'http://43.138.143.241:8081'
  let promise = new Promise((resolve, reject) => {
    uni.request({
      url: baseURL + options.url,
      method: options.method || 'GET',
      data: options.data,
      header: {
        "X-LC-Id": "7yoqQxyLBNN9MW5rsgTGXbHL-gzGzoHsz",
        "X-LC_Key": "hA8yGYuHjnXWRuilrzTe0C3P",
        "Content-Type": "application/json",
        "token": token
      },
    }).then(res => {
      console.log(res.data);
      resolve(res)
    }).catch(err => {
      console.log(err);
      reject(err)
    })
  })
  return promise
}

export default $http
